package com.itheima.reggie.entity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

import com.itheima.reggie.converter.LocalDateTimeConverter;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")

public class Employee implements Serializable {
    private static final long serialVersionUID = 1L;

    @JsonSerialize(using = ToStringSerializer.class)
    @ExcelProperty(value = "员工ID" , index = 0)
    private Long id;

    @ExcelProperty(value = "员工姓名",index = 1)
    private String username;

    @ExcelProperty(value = "登录姓名" , index = 2)
    private String name;

    @ExcelIgnore
    private String password;

    @ExcelProperty(value = "手机号码",index = 3)
    private String phone;

    @ExcelProperty(value = "性别",index = 4)
    private String sex;

    @ExcelProperty(value = "员工编号" ,index = 5)
    private String idNumber; //驼峰命名法 ---> 映射的字段名为 id_number

    @ExcelProperty(value = "员工状态",index = 6)
    private Integer status;

    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = "创建时间" ,converter = LocalDateTimeConverter.class)
    private LocalDateTime createTime;


    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = "更新时间" ,converter = LocalDateTimeConverter.class)
    private LocalDateTime updateTime;

    //private LocalDateTime created;

    @TableField(fill = FieldFill.INSERT)
    @ExcelProperty(value = "创建人" )
    private Long createUser;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ExcelProperty(value = "修改人" )
    private Long updateUser;

}